home *** CD-ROM | disk | FTP | other *** search
/ Aminet 52 / Aminet 52 (2002)(GTI - Schatztruhe)[!][Dec 2002].iso / Aminet / game / think / AmiChess.lha / AmiChess / src / hung.c < prev    next >
C/C++ Source or Header  |  2002-10-31  |  835b  |  26 lines

  1. #include "common.h"
  2.  
  3. short EvalHung(short side)
  4. {
  5. BitBoard c;
  6. short xside;
  7. xside=1^side;
  8. hunged[side]=0;
  9. c=(Ataks[xside][pawn]&board.b[side][knight]);
  10. c|=(Ataks[xside][0]&board.b[side][knight]&~Ataks[side][0]);
  11. if(c) hunged[side]+=nbits(c);
  12. c=(Ataks[xside][pawn]&board.b[side][bishop]);
  13. c|=(Ataks[xside][0]&board.b[side][bishop]&~Ataks[side][0]);
  14. if(c) hunged[side]+=nbits(c);
  15. c=Ataks[xside][pawn]|Ataks[xside][knight]|Ataks[xside][bishop];
  16. c=(c&board.b[side][rook]);
  17. c|=(Ataks[xside][0]&board.b[side][rook]&~Ataks[side][0]);
  18. if(c) hunged[side]+=nbits(c);
  19. c=Ataks[xside][pawn]|Ataks[xside][knight]|Ataks[xside][bishop]|Ataks[xside][rook];
  20. c=(c&board.b[side][queen]);
  21. c|=(Ataks[xside][0]&board.b[side][queen]&~Ataks[side][0]);
  22. if(c) hunged[side]+=nbits(c);
  23. if(Ataks[xside][0]&board.b[side][king]) hunged[side]++;
  24. return hunged[side];
  25. }
  26.